<template>
  <div v-if="visible">
    <el-dialog :visible.sync="visible"
               title="操作记录"
               :modal="false"
               class="user-dialog add-or-updata"
               width="35%"
               :before-close="closeDialog"
               :close-on-click-modal="false"
               :close-on-press-escape="false">
      <table-template :tableData='tableData'
                      :loading='dataListLoading'
                      :fieldManagement='false'
                      height="500px"
                      :dataList='dataList'>
      </table-template>
      <el-pagination :current-page='page'
                     :page-sizes='[10,20,50,100]'
                     :total='total'
                     :pageSize="pageSize"
                     layout='total, sizes, prev, pager, next'
                     @size-change='pageSizeChangeHandle'
                     @current-change='pageCurrentChangeHandle'>
      </el-pagination>
    </el-dialog>
  </div>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import minFormValidate from '@/mixins/form-validate'
import TableTemplate from '@/components/table-template'
export default {
  mixins: [mixinViewModule, minFormValidate],
  data () {
    return {
      mixinViewModuleOptions: {
        activatedIsNeed: false,
        getDataListURL: '/system/sysUser/getUserLogPage', // 数据列表接口，API地址
        getDataListIsPage: true, // 数据列表接口，是否需要分页？
        addOrUpdateURL: '', // 添加或修改接口，API地址
        getDataInfoURL: '', // 数据详情，API地址
        deleteURL: '', // 删除接口，API地址
        deleteIsBatch: true, // 删除接口，是否需要批量？
        exportURL: '' // 导出接口，API地址
      },
      visible: false,
      dataForm: {}
    }
  },
  components: {
    TableTemplate
  },
  computed: {
    tableData () {
      return [
        { label: '操作记录', prop: 'record' },
        { label: '操作时间', width: '150', prop: 'createDate' }
      ]
    }
  },
  methods: {
    closeDialog () {
      this.visible = false
      this.pageSize = 10
    },
    init (data) {
      data = data || {}
      this.visible = true
      this.dataForm.userId = data.id
      this.$nextTick(() => {
        this.getDataList()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.add-or-updata {
  // height: 300px;
}
</style>
